<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 异步的结果无法通过返回值获取
    function getData () {
      let data = null
      setTimeout(() => {
        data = 100
      }, 1000)
      return data
    }

    const ret = getData()
    console.log(ret)
  </script>
</body>
</html>
